bitkeeper revision 1.1159.76.8 (414952f4XmpfTwUZczAePp3RY8piQQ)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 16 Sep 2004 08:46:44 +0000 (08:46 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Thu, 16 Sep 2004 08:46:44 +0000 (08:46 +0000)
A few network cleanups (but this fixes no bugs).

linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c
linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c

index 103bcbd72f13e92d3ea092d986eea5c0e10080b4..d59ff8ef2245647619f6a2383089df83bbc59de9 100644 (file)
@@ -108,10 +108,6 @@ static inline void maybe_schedule_tx_action(void)
         tasklet_schedule(&net_tx_tasklet);
 }
 
-/*
- * This is the primary RECEIVE function for a network interface.
- * Note that, from the p.o.v. of /this/ OS it looks like a transmit.
- */
 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
     netif_t *netif = (netif_t *)dev->priv;
@@ -156,7 +152,7 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
     return 0;
 
  drop:
-    netif->stats.rx_dropped++;
+    netif->stats.tx_dropped++;
     dev_kfree_skb(skb);
     return 0;
 }
@@ -260,8 +256,8 @@ static void net_rx_action(unsigned long unused)
         skb_shinfo(skb)->nr_frags = 0;
         skb_shinfo(skb)->frag_list = NULL;
 
-        netif->stats.rx_bytes += size;
-        netif->stats.rx_packets++;
+        netif->stats.tx_bytes += size;
+        netif->stats.tx_packets++;
 
         /* The update_va_mapping() must not fail. */
         if ( unlikely(mcl[0].args[5] != 0) )
@@ -579,8 +575,8 @@ static void net_tx_action(unsigned long unused)
         skb->dev      = netif->dev;
         skb->protocol = eth_type_trans(skb, skb->dev);
 
-        netif->stats.tx_bytes += txreq.size;
-        netif->stats.tx_packets++;
+        netif->stats.rx_bytes += txreq.size;
+        netif->stats.rx_packets++;
 
         netif_rx(skb);
         netif->dev->last_rx = jiffies;
index 1c06463e953cef83ea7e9533fe2869693ce2c745..9501c269781dc6f023d4d1e909df51268b7a2f73 100644 (file)
@@ -358,7 +358,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
     {
         printk(KERN_ALERT "%s: full queue wasn't stopped!\n", dev->name);
         netif_stop_queue(dev);
-        return -ENOBUFS;
+        goto drop;
     }
 
     if ( unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
@@ -366,7 +366,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
     {
         struct sk_buff *new_skb;
         if ( unlikely((new_skb = alloc_skb_page()) == NULL) )
-            return 1;
+            goto drop;
         skb_put(new_skb, skb->len);
         memcpy(new_skb->data, skb->data, skb->len);
         dev_kfree_skb(skb);
@@ -378,7 +378,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
     if ( np->backend_state != BEST_CONNECTED )
     {
         spin_unlock_irq(&np->tx_lock);
-        return 1;
+        goto drop;
     }
 
     i = np->tx->req_prod;
@@ -414,6 +414,11 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
         notify_via_evtchn(np->evtchn);
 
     return 0;
+
+ drop:
+    np->stats.tx_dropped++;
+    dev_kfree_skb(skb);
+    return 0;
 }